home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 273_01.zip / TCUTIL.DOC < prev    next >
Text File  |  1993-04-04  |  42KB  |  1,478 lines

  1.  
  2.                                TCUTIL
  3.  
  4.                           TurboC Utilities
  5.                           Developed By Jim Derr
  6.                           2425 Santa Cruz Ct.
  7.                           Santa Rosa, Ca. 95401
  8.  
  9.  
  10. This is may first attempt at distributing software.  I have found
  11. numerous execelant software tools and packages on BBS's and I hope
  12. that someone can find these routines usefull.
  13.  
  14. After I received TURBOC in the mail I was dismayed to find out that
  15. it did not contain any video or bios routines.  So in order to use
  16. TURBOC I set out looking for a commerical package and/or a shareware
  17. package to meet my needs.  The commerical packages were a little steep
  18. in price and the most of the shareware packaged were overkill.
  19.  
  20. I decided to develop a set of my own routines and distribute them to
  21. the BBS community.  This is my first cut at the routines with more
  22. and better things to come.  I have included the source code for all
  23. the routines.  All the routines have been tested using the tiny and
  24. small memory models.
  25.  
  26. Just to protect myself I do not guarantee these routines, use them
  27. at your own risk.  They have been tested on PC/XT's, 3270-PC's,
  28. Personal System/2 model 60, and Compaq Portables.  They should
  29. work on any good clone that is BIOS compatable.
  30.  
  31. I have also included the small library files for those of
  32. you that do not have access to a lib program.  Also included are
  33. bat files to compile and reproduce the lib file.
  34.  
  35. PLEASE NOTE THAT THERE ARE MANY HOURS OF WORK IN THESE ROUTINES.
  36. IF YOU FIND THEM USEFULL AND YOU USE THEM IN YOUR PROGRAMS PLEASE SEND
  37. $10 TO THE ADDRESS SHOWN ON PAGE 1 OF THIS DOCUMENT.
  38.  
  39. Files Included are:
  40.  
  41. tcutil.doc     the documentation file
  42. tcutil.h       the header file required by the routines
  43. tcutils.lib    the small model library file
  44. compall.bat    a batch file to compile all the source code.
  45. *.cc           source of functions that are written entirely in c.
  46. *.ca           source of functions that use inline assembler code.
  47.  
  48.  
  49.                       Notes on Using these routines:
  50.  
  51.  
  52. Most of these routines are fairly self explanitory.  However a few
  53. need some additional comments.
  54.  
  55. BEFORE USING ANY OF THESE ROUTINES IN YOUR PROGRAM YOU MUST!!!!!!!!!!!
  56. USE THE VIDEO_TYPE ROUTINES.
  57.  
  58. This routine sets up some global
  59. variables that the other routines will use.  If you complie your
  60. program and get an undefined refenece to any one of the following
  61. you forgot to use the video_type routine.
  62.                 bios, cga, ega, color, mono, scrseg.
  63.  
  64.  
  65. The make_window routine does not save the portion of the screen it
  66. is writing over.  There are times when I don't want to save the area
  67. and I don't want a routine assuming I want to save it.  If you want
  68. to save the information under the window use the save_scr and rest_scr
  69. functions to save and restore the information.
  70.  
  71. The save_scr function does not allocate memory for you, you must do
  72. it yourself.  This allows you the freedom to either allocate it
  73. statically or dynamically.  Included in the tcutil header file are
  74. two macros that will correctly calculate the amount of memory you
  75. need to allocate to save the information under a given window.
  76. The following two examples show how to use these macros:
  77.  
  78. STATIC ALLOCATION:------------------------------------------------------
  79. #define screen1_size setsize_w(0,0,24,79)  /*number of bytes needed to
  80. char save_screen1[screen1_size];             save a full screen with
  81.             .                                no shadow */
  82.             .
  83.             .
  84. save_scr(0,0,24,79,save_screen1);
  85.  
  86.  
  87.  
  88. DYNAMIC ALLOCATION:-----------------------------------------------------
  89. #define screen2_size setsize_ws(0,0,10,20) /*number of bytes needed to
  90. char *save_point;                            save a screen with the
  91. save_point = (char *)malloc(screen2_size);   coordinated of 0,0,10,20
  92.              .                               that will have a shadow */
  93.              .
  94.              .
  95. save_scr(0,0,10,20,save_point);
  96.  
  97.  
  98. There is also another macro in the TCUTIL.H file to aid you in
  99. defining attribute bytes.  To use it code your attributes as
  100. follows:
  101.  
  102. int attr1 = setatr(BLUE,BLACK,0,0);
  103.                     |     |   | |
  104. forground color-----+     |   | |
  105. background color----------+   | |
  106. blink-------------------------+ |   (where blink and bold is 0 or 1)
  107. bold----------------------------+
  108.  
  109.  
  110. Most of the routines do not return any values.  However if they do
  111. the value returned and it's type is shown in the documentation of
  112. the function.
  113.  
  114. RELEASE 2.0 10/19/87 UPDATES:
  115.  
  116. The following new functions have been added to release 2.0:
  117.  
  118. beep        activate the speaker.
  119. get_xa        read a keystoke and return normal and extended key codes.
  120. soundx      compute a soundex code for a string
  121. str_xform    transform characters in a string
  122.  
  123. The following functions have been enhanced or changed.
  124.  
  125. writef      enhanced for speed.
  126. get_line    enhanced/changed.  The function will now return any non-printable
  127.             character as an extended coded int.
  128. TCUTIL.H    extended coded ints are now defined in the header.
  129.  
  130. RELEASE 3.0 2/15/88 UPDATES:
  131.  
  132. The following new functions have been addded:
  133.  
  134. getfield    read a string from the screen under control of a format mask.
  135. xprintf     like printf but writes directly to the video buffer.
  136. melt        4 different ways to restore the screen.
  137.  
  138.  
  139.  
  140.  
  141. If you find any error or bugs please drop me a line.
  142. Also if there is some function
  143. you would like added to this library also drop me a line.
  144.  
  145.  
  146.                       !!!!ENJOY!!!!!
  147.  
  148. Jim Derr
  149. 2425 Santa Cruz Ct.
  150. Santa Rosa, Ca. 95401
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157. beep                                                                [BEEP.CC]
  158.  
  159. void     beep(unsigned int pitch, unsigned int nticks )
  160. /* Sound the speaker using indicated pitch for nticks long
  161.    for error sound use beep(440,3) beep(220,3)
  162. */       
  163.  
  164.  
  165. --------------------------------------------------------------------------
  166.  
  167.  
  168.  
  169.  
  170. box                                                                  [BOX.CC]
  171.  
  172. void box(int trow, int tcol, int lrow, int lcol, int wattr, int battr)
  173. /* This will draw a box using upper left row,col and lower right row,col
  174.    wattr is attribute character for center of box, battr is the border attr.    
  175. */
  176.  
  177.  
  178. --------------------------------------------------------------------------
  179.  
  180.  
  181.  
  182.  
  183. calc_tots                                                        [CALCTOT.CC]
  184.  
  185. long calc_tots(char *curr_path)
  186. /* This function will accept a valid path name I.E. c:\dos and will return
  187.    the total number of bytes occupied by all files in the specified directory.
  188. */
  189.  
  190.  
  191. --------------------------------------------------------------------------
  192.  
  193.  
  194.  
  195.  
  196. ccolor                                                            [CCOLOR.CC]
  197.  
  198. ccolor(int row, int col, int attr, int len)
  199. /* This routine will change the color attributes of a column of characters.
  200.    row=row to start changing color
  201.    col=col to start changing color
  202.    attr=attribute to change to
  203.    len=number of rows down the screen to change.
  204. */
  205.  
  206.  
  207. --------------------------------------------------------------------------
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.                                   - 1 -
  217.  
  218.  
  219.  
  220. change_to                                                          [CHGTO.CC]
  221.  
  222. change_to(char *dir)
  223. /*
  224. ┌────────────────────────────────────────────────────────────────────┐
  225. │Purpose: To change the current disk drive and directory with        │
  226. │         one call.                                                  │
  227. │ Inputs: Char *dir points to directory to change to. This may       │
  228. │         contain a drive letter if required.                        │
  229. │Outputs: None.                                                      │
  230. │                                                                    │
  231. │ Return:  0 = successful.                                           │
  232. │         -1 = directory not found.                                  │
  233. └────────────────────────────────────────────────────────────────────┘
  234. */
  235.  
  236.  
  237. --------------------------------------------------------------------------
  238.  
  239.  
  240.  
  241.  
  242. clr                                                                  [CLR.CC]
  243.  
  244. void clr(wattr)
  245. /* CLear the screen using the attribute passed */
  246.  
  247.  
  248. --------------------------------------------------------------------------
  249.  
  250.  
  251.  
  252.  
  253. clr_eol                                                           [CLREOL.CC]
  254.  
  255. clr_eol(int last_col)
  256. /* This will clear from the current cursor location the the end of the line.
  257.    The last column of the line is specified as last_col
  258. */
  259.  
  260.  
  261.  
  262. --------------------------------------------------------------------------
  263.  
  264.  
  265.  
  266.  
  267. clrarea                                                          [CLRAREA.CC]
  268.  
  269. void clrarea(int trow,int tcol,int lrow,int lcol,int wattr)
  270. /* Clear a portion of the screen using the passed attribute
  271.     trow = upper left row of area
  272.     tcol = upper left col of area
  273.     lrow = lower right row of area
  274.     lcol = lower right col of area
  275. */
  276.  
  277.  
  278. --------------------------------------------------------------------------
  279.                                   - 2 -
  280.  
  281.  
  282.  
  283. clrbox                                                            [CLRBOX.CC]
  284.  
  285. void clrbox(int trow,int tcol,int lrow,int lcol,int wattr)
  286. /* Clear the area inside the box built by the BOX function to the
  287.    specified attribute
  288. */
  289.  
  290.  
  291. --------------------------------------------------------------------------
  292.  
  293.  
  294.  
  295.  
  296. cur_dn                                                             [CURDN.CC]
  297.  
  298. cur_dn()
  299. /* Move the down one row. This will wrap the cursor to the top of
  300.    the screen if the cursor is on the last row
  301. */
  302.  
  303.  
  304. --------------------------------------------------------------------------
  305.  
  306.  
  307.  
  308.  
  309. cur_lf                                                             [CURLF.CC]
  310.  
  311. cur_lf()
  312. /* Move the cursor one col to the left */
  313.  
  314.  
  315. --------------------------------------------------------------------------
  316.  
  317.  
  318.  
  319.  
  320. cur_nl                                                             [CURNL.CC]
  321.  
  322. cur_nl() 
  323. /* Move the cursor to the beginning of the next row  */
  324.  
  325.  
  326. --------------------------------------------------------------------------
  327.  
  328.  
  329.  
  330.  
  331. cur_rt                                                             [CURRT.CC]
  332.  
  333. cur_rt()
  334. /* Move the cursor one col to the right */
  335.  
  336.  
  337. --------------------------------------------------------------------------
  338.  
  339.  
  340.  
  341.  
  342.                                   - 3 -
  343.  
  344.  
  345.  
  346. cur_up                                                             [CURUP.CC]
  347.  
  348. cur_up() 
  349. /* Move the cursor one row up */
  350.  
  351.  
  352. --------------------------------------------------------------------------
  353.  
  354.  
  355.  
  356.  
  357. do_pull_down                                                      [TCMENU.CC]
  358.  
  359. do_pull_down(struct pull_down *pull, struct menu_struc *menu1)
  360.  
  361.  
  362. --------------------------------------------------------------------------
  363.  
  364.  
  365.  
  366.  
  367. file_exist                                                      [FILEXIST.CC]
  368.  
  369. file_exist(char *fn)
  370. /* Check to see of a Find exists.
  371.     RETURN 1 if exist 0 if not.
  372. */
  373.  
  374.  
  375. --------------------------------------------------------------------------
  376.  
  377.  
  378.  
  379.  
  380. find_file                                                       [FINDFILE.CC]
  381.  
  382. find_file(char *dir_str, char *file_spec, char *dir_hit, char *file_hit,char *srch_type)
  383. /* find_file will search a disk looking for a specified file. Parms are:
  384.     char *dir_str = starting disk and directory to begin search.
  385.     char *file_spec = file spec to search for.
  386.     char *srch_type = "e" to search for executables i.e. bat, com, or exe.
  387.                     = "n" to search for anything.
  388.                     if search type is set to "e" and a file is found
  389.                     *srch_type will be set to b,c, or e indicating the
  390.                     type of file found. b=batch, c=com, e=exe.
  391.     char *dir_hit   = if file found the directory the file was found in.
  392.     char *file_hit  = if file found the filename.ext of the file.
  393.     RETURN CODE = 1 if file found.
  394.                 = 0 if not found.
  395. */
  396.  
  397.  
  398. --------------------------------------------------------------------------
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.                                   - 4 -
  406.  
  407.  
  408.  
  409. flush_key                                                       [FLUSHKEY.CC]
  410.  
  411. flush_key()
  412. /* This will flush the keyboard buffer */
  413.  
  414.  
  415. --------------------------------------------------------------------------
  416.  
  417.  
  418.  
  419.  
  420. get_akey                                                         [GETAKEY.CC]
  421.  
  422. get_akey(char *ch, char *list)
  423. /* Wait until one of the charaacters in the list is pressed. ch will be set
  424.    to the upper case value of the key pressed.
  425. */
  426.  
  427.  
  428. --------------------------------------------------------------------------
  429.  
  430.  
  431.  
  432.  
  433. get_attr                                                         [GETATTR.CC]
  434.  
  435. int get_attr(int row, int col)
  436. /* Get the attribute at the specified row and col.
  437.    RETURNED is attr
  438. */
  439.  
  440.  
  441. --------------------------------------------------------------------------
  442.  
  443.  
  444.  
  445.  
  446. get_ca                                                             [GETCA.CC]
  447.  
  448. get_ca(char *ch, char *scan) 
  449. /* Read a keystroke.  ch=character code or zero if extended code
  450.                     scan=extended code or scan code
  451. */
  452.  
  453.  
  454. --------------------------------------------------------------------------
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.                                   - 5 -
  469.  
  470.  
  471.  
  472. get_chars                                                       [GETCHARS.CC]
  473.  
  474. int get_chars(int row, int col, int leng, char *string)
  475. /* This will read leng characters from the screen at the location specified
  476.    by row,col and will place the characters (not the attr bytes) into the
  477.    string pointed to by *string.
  478. */
  479.  
  480.  
  481. --------------------------------------------------------------------------
  482.  
  483.  
  484.  
  485.  
  486. get_cur                                                           [GETCUR.CC]
  487.  
  488. get_cur(int *row, int *col)
  489. /* return the current cursor location into row,col.
  490.    If the cursor is hidden return value will be 1 else 0 will be returned.    
  491. */
  492.  
  493.  
  494. --------------------------------------------------------------------------
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.                                   - 6 -
  532.  
  533.  
  534.  
  535. get_field                                                       [GETFIELD.CC]
  536.  
  537. get_field(int row, int col, char *str, int sleng, int attr, int dleng, char *mask)
  538. /*
  539. ┌────────────────────────────────────────────────────────────────────┐
  540. │Purpose: To provide for formatted field input capability.           │
  541. │                                                                    │
  542. │ Inputs: row = row to read field from                               │
  543. │         col = col to read field from                               │
  544. │         *str = pointer to char string to store field into.         │
  545. │         sleng = leng of string pointed to by *str.                 │
  546. │         attr = attribute used to display field.                    │
  547. │         dleng = length of display area.                            │
  548. │         *mask = pointer to mask string.                            │
  549. │         (THE MASK STRING MUST BE THE SAME LENGTH AS IS SPECIFIED   │
  550. │          IN THE SLENG PARAMETER!!!!  THE MASK CONSISTS OF THE      │
  551. │          FOLLOWING SPECIAL CHARACTERS.                             │
  552. │          A = allow alpha characters only in this position.         │
  553. │          N = allow numeric characters only in this position.       │
  554. │      blank = allow any characters in this position.                │
  555. │          # = force the enter key when the user hits this position. │
  556. │                                                                    │
  557. │          ANY OTHER CHARACTER IN THE MASK FIELD WILL BE DISPLAYED   │
  558. │          ON THE SCREEN AND INPUT WILL NOT BE ALLOWED IN THAT       │
  559. │          POSITION. NOTE!!!!!!!!!! THE A AND N MASK CHARACTERS      │
  560. │          MUST BE UPPER CASE IN ORDER TO BE RECOGNIZED!!!!!!!!!!!!!!│
  561. │                                                                    │
  562. │Outputs: None.                                                      │
  563. │                                                                    │
  564. │                                                                    │
  565. │ Return: An integer value indicating the key that was pressed to    │
  566. │         terminate the entry of the field.  I.E. the enter key      │
  567. │         or the ESC key.                                            │
  568. │                                                                    │
  569. └────────────────────────────────────────────────────────────────────┘
  570. */
  571.  
  572.  
  573. --------------------------------------------------------------------------
  574.  
  575.  
  576.  
  577.  
  578. get_line                                                         [GETLINE.CC]
  579.  
  580. get_line(char *str, int sleng, int attr, int dleng)
  581. /* This will read s string from the screen starting at the current cursor
  582.    location.  The length of the string is specified by sleng, the length
  583.    of the display area is specified by dleng.  Attr specifies the attribute
  584.    to use when displaying the field.
  585.    RETURNED is the character code that terminated the input string.
  586.    I.E. enter key, esc key, function keys, etc.
  587. */
  588.  
  589.  
  590. --------------------------------------------------------------------------
  591.  
  592.  
  593.  
  594.                                   - 7 -
  595.  
  596.  
  597.  
  598. get_linex                                                       [GETLINEX.CC]
  599.  
  600. get_linex(int row, int col, char *str, int sleng, int attr, int dleng)
  601. /* This will read a string from the screen starting row,col.
  602.    The String that is read will be put into the string pointed to by *str.
  603.    The length of the string is specified by sleng.
  604.    The length of the display area is specified by dleng.
  605.    Attr specifies the attribute to use when displaying the field.
  606.    RETURNED is the character code that terminated the input string.
  607.    I.E. enter key, esc key, function keys, etc.
  608. */
  609.  
  610.  
  611. --------------------------------------------------------------------------
  612.  
  613.  
  614.  
  615.  
  616. get_long_date                                                   [GETLDATE.CC]
  617.  
  618. long int get_long_date()
  619. /*
  620. ┌────────────────────────────────────────────────────────────────────┐
  621. │Purpose: Get the current date.                                      │
  622. │                                                                    │
  623. │ Inputs: None.                                                      │
  624. │                                                                    │
  625. │Outputs: None.                                                      │
  626. │                                                                    │
  627. │ Return: A long int containing the current date in the format       │
  628. │         YYMMDD.                                                    │
  629. └────────────────────────────────────────────────────────────────────┘
  630. */
  631.  
  632.  
  633. --------------------------------------------------------------------------
  634.  
  635.  
  636.  
  637.  
  638. get_scode                                                         [SOUNDX.CC]
  639.  
  640. char get_scode(ch)
  641. char ch;
  642.  
  643.  
  644. --------------------------------------------------------------------------
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.                                   - 8 -
  658.  
  659.  
  660.  
  661. get_xa                                                             [GETXA.CC]
  662.  
  663. get_xa()
  664. /* Read a keystroke.
  665.    An int will be returned as follows:
  666.       return value will be ascii code of key pressed or
  667.              value will be scan code of key press + 256 if the key press
  668.              was an extended key.  i.e. function key etc.
  669.  
  670.   The definitions of the extended keys are in the TCUTIL.H file.
  671. */
  672.  
  673.  
  674. --------------------------------------------------------------------------
  675.  
  676.  
  677.  
  678.  
  679. getfsize                                                        [GETFSIZE.CC]
  680.  
  681. long getfsize(char *fn)
  682. /* Return the filesize of a file.
  683.    char *fn is a pointer to the filespec.
  684.  
  685.    return = -1 if file is not found.
  686.    else returned will be the size of the file.
  687. */
  688.  
  689.  
  690. --------------------------------------------------------------------------
  691.  
  692.  
  693.  
  694.  
  695. hide_cur                                                         [HIDECUR.CC]
  696.  
  697. hide_cur()
  698. /* Turn the cursor off */
  699.  
  700.  
  701. --------------------------------------------------------------------------
  702.  
  703.  
  704.  
  705.  
  706. index                                                              [INDEX.CC]
  707.  
  708. char *index(char *str, char c)
  709. /*------------------------------------------------------------------------------
  710. INDEX - returns a pointer to the first occurance of 'c' in the string pointed
  711. to by 'str', or NULL if 'str' does not contain 'c'.
  712. ------------------------------------------------------------------------------*/
  713.  
  714.  
  715. --------------------------------------------------------------------------
  716.  
  717.  
  718.  
  719.  
  720.                                   - 9 -
  721.  
  722.  
  723.  
  724. left_str                                                         [LEFTSTR.CC]
  725.  
  726. left_str(int x, char *str, char *new_str)
  727. /* Please the left x number of character from *str into *new_str */
  728.  
  729.  
  730. --------------------------------------------------------------------------
  731.  
  732.  
  733.  
  734.  
  735. locate                                                            [LOCATE.CC]
  736.  
  737. locate(int row, int col)
  738. /* Position the cursor at row,col */
  739.  
  740.  
  741. --------------------------------------------------------------------------
  742.  
  743.  
  744.  
  745.  
  746. make_shadow                                                       [SHADOW.CC]
  747.  
  748. make_shadow(int trow, int tcol, int brow, int bcol)
  749. /* This will create the illusion of a shadow under the window specified by:
  750.    trow=upper left row
  751.    tcol=upper left col
  752.    brow=lower right row
  753.    bcol=lower right col
  754. */
  755.  
  756.  
  757. --------------------------------------------------------------------------
  758.  
  759.  
  760.  
  761.  
  762. make_window                                                     [MAKEWIND.CC]
  763.  
  764. make_window(int trow, int tcol, int brow, int bcol, int wattr, int battr, int shadow, char *title, char *footer)
  765. /* Make a window at the specified location.
  766.    trow=upper left row of window   range 0-24
  767.    tcol=upper left col of windoe   range 0-79
  768.    brow=lower right row of window
  769.    bcol=lower right col of window
  770.    wattr=attribute of window
  771.    battr=attribute of border of window
  772.    shadow=0=no shadow =1=make a shadow
  773.    title=title for window
  774.    footer=bottom footer for window
  775.    Needs the following golbal data defined:
  776.    int color, mono, cga, ega, scrseg, bios;
  777. */
  778.  
  779.  
  780.  
  781. --------------------------------------------------------------------------
  782.  
  783.                                   - 10 -
  784.  
  785.  
  786.  
  787. melt                                                                [MELT.CC]
  788.  
  789. melt(int attr, char type)
  790. /* Melt will clear the screen in various ways and will set the attributes to
  791.    attr.
  792.    type = t,b,l,r,a
  793.           t=clear from top to bottom
  794.           b=clear from bottom to top
  795.           l=clear from left to right
  796.           r=clear from right to left
  797.           a=implode screen (clear from outside to inside)
  798. */
  799.  
  800.  
  801. --------------------------------------------------------------------------
  802.  
  803.  
  804.  
  805.  
  806. menubar                                                           [TCMENU.CC]
  807.  
  808. menubar(struct menu_struc *menu1, struct pull_down *pulls)
  809. /*     This function will display a menu-bar at the top of the screen.
  810.     Before calling this function you must set up the two menu stuctures
  811.     needed my the function. The two structures are:
  812.     1) menu_struc
  813.     2) pull_down
  814.     The structures are defined in tcmenu.h.  To initialize do the following:
  815.  
  816.  
  817.  
  818. --------------------------------------------------------------------------
  819.  
  820.  
  821.  
  822.  
  823. mid_str                                                           [MIDSTR.CC]
  824.  
  825. mid_str(int begin, int leng, char *o_str, char *n_str)
  826. /* Extract the characters from *o_str starting at position begin for leng
  827.    number of characters and place them into *n_str.
  828. */
  829.  
  830.  
  831. --------------------------------------------------------------------------
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.                                   - 11 -
  847.  
  848.  
  849.  
  850. parse_fn                                                         [PARSEFN.CC]
  851.  
  852. parse_fn(char *fspec,char *fdrive, char *fpath, char *fn, char *fe)
  853. /* This function will parse and break apart the filespec pointed to
  854.    by *fspec.    It will pass back the drive, directory, filename, extension.
  855.    If a given part does not exist a NULL character string will be passed
  856.    back.
  857. */
  858.  
  859.  
  860. --------------------------------------------------------------------------
  861.  
  862.  
  863.  
  864.  
  865. print_char                                                       [PRINTER.CC]
  866.  
  867. print_char(char ch, int lptnum)
  868. /* Print the character ch on printer lptnum where lptnum = 1-3.
  869.    RETURNED = 0 if ok.
  870.             = 1 if error.
  871. */
  872.  
  873.  
  874. --------------------------------------------------------------------------
  875.  
  876.  
  877.  
  878.  
  879. print_init                                                       [PRINTER.CC]
  880.  
  881. print_init(int lptnum)
  882. /* Initialize the printer identified by lptnum. lptnum = 1-3 */
  883.  
  884.  
  885. --------------------------------------------------------------------------
  886.  
  887.  
  888.  
  889.  
  890. print_stat                                                       [PRINTER.CC]
  891.  
  892. print_stat(int lptnum)
  893. /* query the status of the printer attached as lptnum. lptnum = 1-3.
  894.     RETURNED = 0 if printer is ready for work.
  895.              = 1 if printer is not ready.
  896. */
  897.  
  898.  
  899. --------------------------------------------------------------------------
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.                                   - 12 -
  910.  
  911.  
  912.  
  913. print_str                                                        [PRINTER.CC]
  914.  
  915. print_str(char *str, int lptnum)
  916. /* Print the string pointed to by *str on printer lptnum where
  917.    lptnum = 1-3.
  918.    RETURNED = 0 if ok.
  919.             = 1 if error.
  920. */
  921.  
  922.  
  923. --------------------------------------------------------------------------
  924.  
  925.  
  926.  
  927.  
  928. put_ca                                                             [PUTCA.CC]
  929.  
  930. put_ca(char ch, int attr, int count)
  931. /* This will put the specified charater and attribute on the screen at
  932.    the current cursor location.
  933. */
  934.  
  935.  
  936. --------------------------------------------------------------------------
  937.  
  938.  
  939.  
  940.  
  941. put_sa                                                             [PUTSA.CC]
  942.  
  943. put_sa(char *ch, int attr)
  944. /* This will put the character string pointer to by *ch on the screen
  945.    at the current cursor location using attribute attr.
  946. */
  947.  
  948.  
  949. --------------------------------------------------------------------------
  950.  
  951.  
  952.  
  953.  
  954. rcolor                                                            [RCOLOR.CC]
  955.  
  956. void rcolor(int row, int col, int attr, int len)
  957. /* This routine will change the color attribute of a row of character.
  958.    row=row to change  range 0-24
  959.    col=beginning col to change    range 0-79
  960.    attr=attribute to change to
  961.    len=num of characters to change
  962. */
  963.  
  964.  
  965. --------------------------------------------------------------------------
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.                                   - 13 -
  973.  
  974.  
  975.  
  976. rest_scr                                                         [RESTSCR.CA]
  977.  
  978. rest_scr(int trow, int tcol, int brow, int bcol, char *array)
  979. /* Restore an area of the current screen that was saved via save_scr.
  980.    To determine num of chars for array use the following formula:
  981. */
  982.  
  983.  
  984. --------------------------------------------------------------------------
  985.  
  986.  
  987.  
  988.  
  989. right_str                                                       [RIGHTSTR.CC]
  990.  
  991. right_str(int x, char *str, char *new_str)
  992. /* This will take the right x number of character from the string pointed
  993.    to by *str and place them into the string pointed to by *new_str.
  994. */
  995.  
  996.  
  997. --------------------------------------------------------------------------
  998.  
  999.  
  1000.  
  1001.  
  1002. s_str_lf                                                          [SSTRLF.CC]
  1003.  
  1004. s_str_lf(int count, char *str)
  1005. /* This will shift the characters in the string pointed to by *str left
  1006.    count number of characters. Blanks will be added in the positions where
  1007.    character are shifted out. The leng of the string will not be changed.
  1008. */
  1009.  
  1010.  
  1011. --------------------------------------------------------------------------
  1012.  
  1013.  
  1014.  
  1015.  
  1016. s_str_rt                                                          [SSTRRT.CC]
  1017.  
  1018. s_str_rt(int count, char *str)
  1019. /* This will shift the characters in the string pointed to by *str right
  1020.    count number of characters. Blanks will be added in the positions where
  1021.    character are shifted out
  1022. */
  1023.  
  1024.  
  1025. --------------------------------------------------------------------------
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.                                   - 14 -
  1036.  
  1037.  
  1038.  
  1039. save_scr                                                         [SAVESCR.CA]
  1040.  
  1041. save_scr(int trow, int tcol, int brow, int bcol, char *array)
  1042. /* Save an area of the current screen into a character array
  1043.    To determine num of chars for array use the following formula:
  1044.    num_chars=((brow-trow+1) * (bcol-tcol+1)) *2;
  1045. */
  1046.  
  1047.  
  1048. --------------------------------------------------------------------------
  1049.  
  1050.  
  1051.  
  1052.  
  1053. scroll_dn                                                       [SCROLLDN.CC]
  1054.  
  1055. scroll_dn(int trow, int lcol,int brow, int rcol,int attr, int lines)
  1056. /* This will scroll the defined window down x number of lines:
  1057.    trow=upper left row
  1058.    lcol=upper left column
  1059.    brow=lower right row
  1060.    rcol=lower right col
  1061.    lines=number of lines to scroll
  1062. */
  1063.  
  1064.  
  1065. --------------------------------------------------------------------------
  1066.  
  1067.  
  1068.  
  1069.  
  1070. scroll_lf                                                       [SCROLLLF.CC]
  1071.  
  1072. scroll_lf(int trow, int tcol, int brow, int bcol, int attr, int no_col)
  1073. /* This will scroll the window defined by trow, tcol, brow, bcol to the
  1074.    left the number of columns indicated by no_col.  The columns exposed
  1075.    after scrolling are set to spaces and are given the attribute specified    
  1076.    by attr.
  1077. */
  1078.  
  1079.  
  1080. --------------------------------------------------------------------------
  1081.  
  1082.  
  1083.  
  1084.  
  1085. scroll_rt                                                       [SCROLLRT.CC]
  1086.  
  1087. scroll_rt(int trow, int tcol, int brow, int bcol, int attr, int no_col)
  1088. /* This will scroll the window defined by trow, tcol, brow, bcol to the
  1089.    right the number of columns indicated by no_col.  The columns exposed
  1090.    after scrolling are set to spaces and are given the attribute specified    
  1091.    by attr.
  1092. */
  1093.  
  1094.  
  1095. --------------------------------------------------------------------------
  1096.  
  1097.  
  1098.                                   - 15 -
  1099.  
  1100.  
  1101.  
  1102. scroll_up                                                       [SCROLLUP.CC]
  1103.  
  1104. scroll_up(int trow, int lcol,int brow, int rcol,int attr, int lines)
  1105. /* This will scroll the specified window up the specified number of lines.
  1106.    SEE SCROLL_DN FOR DESCP. IF ARGS PASSED
  1107. */
  1108.  
  1109.  
  1110. --------------------------------------------------------------------------
  1111.  
  1112.  
  1113.  
  1114.  
  1115. set_mode                                                         [SETMODE.CC]
  1116.  
  1117. set_mode(int mode)
  1118. /* This will set the video mode to the mode passed */
  1119.  
  1120.  
  1121. --------------------------------------------------------------------------
  1122.  
  1123.  
  1124.  
  1125.  
  1126. show_cur                                                         [SHOWCUR.CC]
  1127.  
  1128. show_cur(int size)
  1129. /* This will make the cursor visiable.
  1130.    size=1 = cursor uses scan lines 6-7.
  1131.    size=9 = cursoe uses scan lines 0-7.
  1132. */
  1133.  
  1134.  
  1135. --------------------------------------------------------------------------
  1136.  
  1137.  
  1138.  
  1139.  
  1140. soundex                                                           [SOUNDX.CC]
  1141.  
  1142. soundex(char *out_pntr, char *in_pntr)
  1143. /*
  1144. ┌────────────────────────────────────────────────────────────────────┐
  1145. │Purpose: Calculate the soundx code of a string.                     │
  1146. │                                                                    │
  1147. │ Inputs: char *out_pntr = pointer to a 5 char array to put the      │
  1148. │                          soundx code into.                         │
  1149. │         char *in_pntr  = pointer to string to calc. soundx code of.│
  1150. │                                                                    │
  1151. │Outputs: Soundx code stored into area pointed to by *out_pntr.      │
  1152. │                                                                    │
  1153. │ Return: None                                                       │
  1154. └────────────────────────────────────────────────────────────────────┘
  1155. */
  1156.  
  1157.  
  1158. --------------------------------------------------------------------------
  1159.  
  1160.  
  1161.                                   - 16 -
  1162.  
  1163.  
  1164.  
  1165. sread_a                                                           [SREADA.CA]
  1166.  
  1167. sread_a(int row, int col, int *attr)
  1168. /* This will read the attr at row,col and place the attr into
  1169.    the area pointed to by attr.
  1170. */
  1171.  
  1172.  
  1173. --------------------------------------------------------------------------
  1174.  
  1175.  
  1176.  
  1177.  
  1178. sread_c                                                           [SREADC.CA]
  1179.  
  1180. sread_c(int row, int col, char *area)
  1181. /* This will do a read a character at row,col and
  1182.    place it into the area pointer to by area.
  1183. */
  1184.  
  1185.  
  1186. --------------------------------------------------------------------------
  1187.  
  1188.  
  1189.  
  1190.  
  1191. sread_ca                                                         [SREADCA.CA]
  1192.  
  1193. sread_ca(int row, int col, char *area)
  1194. /* This will read the character and attr at row,col and place them into the
  1195.    string pointed to by area.
  1196. */
  1197.  
  1198.  
  1199. --------------------------------------------------------------------------
  1200.  
  1201.  
  1202.  
  1203.  
  1204. str_xform                                                       [STRXFORM.CC]
  1205.  
  1206. str_xform(char *str,char from,char to)
  1207. /* This function will transform all characters in the string pointed to
  1208.    by *str that are the same as the from character to the to char.
  1209. */
  1210.  
  1211.  
  1212. --------------------------------------------------------------------------
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.                                   - 17 -
  1225.  
  1226.  
  1227.  
  1228. stridel                                                          [STRIDEL.CC]
  1229.  
  1230. stridel(char *substr, char *str)
  1231. /*
  1232. ┌────────────────────────────────────────────────────────────────────┐
  1233. │Purpose: To delete the string pointed to by *substr from the string │
  1234. │         pointed to by *str ignoring case.                          │
  1235. │                                                                    │
  1236. │ Inputs: char *substr = pointer to substring to delete.             │
  1237. │         char *str    = pointer to string to delete from.           │
  1238. │                                                                    │
  1239. │Outputs: substr deleted from str.                                   │
  1240. │                                                                    │
  1241. │ Return: = 0 substr not found in str.                               │
  1242. │         = 1 substr deleted from str.                               │
  1243. │                                                                    │
  1244. │                                                                    │
  1245. └────────────────────────────────────────────────────────────────────┘
  1246. */
  1247.  
  1248.  
  1249. --------------------------------------------------------------------------
  1250.  
  1251.  
  1252.  
  1253.  
  1254. strip                                                              [STRIP.CC]
  1255.  
  1256. strip(char *str, char c)
  1257. /* This will string all occurances of char c out of string pointed to by *str */
  1258.  
  1259.  
  1260. --------------------------------------------------------------------------
  1261.  
  1262.  
  1263.  
  1264.  
  1265. striprange                                                      [STRIPRNG.CC]
  1266.  
  1267. striprange(char *str,char clo,char chi)
  1268. /* This will strip all occurances of the characters that fall between
  1269.    char clo and chi out of the string pointed to by *str.
  1270. */
  1271.  
  1272.  
  1273. --------------------------------------------------------------------------
  1274.  
  1275.  
  1276.  
  1277.  
  1278. swrite_a                                                         [SWRITEA.CA]
  1279.  
  1280. swrite_a(int row, int col, int attr)
  1281. /* This will write the attribute attr at row,col
  1282. */
  1283.  
  1284.  
  1285. --------------------------------------------------------------------------
  1286.  
  1287.                                   - 18 -
  1288.  
  1289.  
  1290.  
  1291. swrite_c                                                         [SWRITEC.CA]
  1292.  
  1293. swrite_c(int row, int col, char ch)
  1294. /* This will do a direct video write of the character ch. It will be
  1295.    placed at location row,col using attribute attr.
  1296. */
  1297.  
  1298.  
  1299. --------------------------------------------------------------------------
  1300.  
  1301.  
  1302.  
  1303.  
  1304. swrite_ca                                                       [SWRITECA.CA]
  1305.  
  1306. swrite_ca(int row, int col, char *area)
  1307. /* This will do a direct video write of the character ch. It will be
  1308.    placed at location row,col using attribute attr.
  1309. */
  1310.  
  1311.  
  1312. --------------------------------------------------------------------------
  1313.  
  1314.  
  1315.  
  1316.  
  1317. test_numeric                                                     [TESTNUM.CC]
  1318.  
  1319. test_numeric(char *str)
  1320.  
  1321.  
  1322. --------------------------------------------------------------------------
  1323.  
  1324.  
  1325.  
  1326.  
  1327. trim_l                                                             [TRIML.CC]
  1328.  
  1329. trim_l(char *str)
  1330. /* This will remove all blanks from the left side of the string
  1331.    pointed to by *str.
  1332. */
  1333.  
  1334.  
  1335. --------------------------------------------------------------------------
  1336.  
  1337.  
  1338.  
  1339.  
  1340. trim_r                                                             [TRIMR.CC]
  1341.  
  1342. trim_r(char *str)
  1343. /* This will trim all blanks characters from the rigth side of the
  1344.    string pointed to by *str.
  1345. */
  1346.  
  1347.  
  1348. --------------------------------------------------------------------------
  1349.  
  1350.                                   - 19 -
  1351.  
  1352.  
  1353.  
  1354. upcase                                                            [UPCASE.CC]
  1355.  
  1356. upcase(char *str)
  1357. /* This will convert the string pointed to by *str to uppercase */
  1358.  
  1359.  
  1360. --------------------------------------------------------------------------
  1361.  
  1362.  
  1363.  
  1364.  
  1365. validate                                                        [VALIDATE.CC]
  1366.  
  1367. validate(char *goods, char val_field)
  1368.  
  1369.  
  1370. --------------------------------------------------------------------------
  1371.  
  1372.  
  1373.  
  1374.  
  1375. video_type                                                      [VIDEOTYP.CC]
  1376.  
  1377. video_type()
  1378. /* This will determine the Video type of the display.
  1379.    This routine defines the following global definition.
  1380.    int color, mono, cga, ega, bios, scrseg;
  1381.    They can be used by other functions if you define them as external
  1382.    definitions.
  1383. */
  1384.  
  1385.  
  1386. --------------------------------------------------------------------------
  1387.  
  1388.  
  1389.  
  1390.  
  1391. write_tty                                                       [WRITETTY.CC]
  1392.  
  1393. write_tty(char *ch)
  1394. /* This will put the character string pointer to by *ch on the screen
  1395.    at the current cursor location using attribute attr.
  1396. */
  1397.  
  1398.  
  1399. --------------------------------------------------------------------------
  1400.  
  1401.  
  1402.  
  1403.  
  1404. writef                                                            [WRITEF.CA]
  1405.  
  1406. writef(int row, int col, int attr, char *mch)
  1407. /* This will do a direct video write of the character ch. It will be
  1408.    placed at location row,col using attribute attr.
  1409. */
  1410.  
  1411.  
  1412. --------------------------------------------------------------------------
  1413.                                   - 20 -
  1414.  
  1415.  
  1416.  
  1417. writef_n                                                         [WRITEFN.CA]
  1418.  
  1419. writef_n(int row, int col, int attr, char *mch, int count)
  1420. /* This will write of the string of characters pointed to by mch.
  1421.    Writing will stop when the end of string is reached or count characters
  1422.    are written.
  1423. */
  1424.  
  1425.  
  1426. --------------------------------------------------------------------------
  1427.  
  1428.  
  1429.  
  1430.  
  1431. writefc                                                          [WRITEFC.CA]
  1432.  
  1433. writefc(int row, int col, int attr, char mch)
  1434. /* This will do a direct video write of the character ch. It will be
  1435.    placed at location row,col using attribute attr.
  1436. */
  1437.  
  1438.  
  1439. --------------------------------------------------------------------------
  1440.  
  1441.  
  1442.  
  1443.  
  1444. xprintf                                                          [XPRINTF.CC]
  1445.  
  1446. void xprintf(int row, int col,int attr, va_list arg_list, ...)
  1447. /*
  1448. ┌────────────────────────────────────────────────────────────────────┐
  1449. │Purpose: Provide for fast formatted output to video screen.         │
  1450. │                                                                    │
  1451. │                                                                    │
  1452. │                                                                    │
  1453. │ Inputs: row = row to display at.                                   │
  1454. │         col = col to display at.                                   │
  1455. │         attr = attr to display text with.                          │
  1456. │         va_list = format string and arguments, these are exactly   │
  1457. │                   the same format as printf requires.              │
  1458. │                                                                    │
  1459. │Outputs: None                                                       │
  1460. │                                                                    │
  1461. │ Return: None                                                       │
  1462. │                                                                    │
  1463. │Also see: writef, writef_n, video_type, make_window.                │
  1464. │                                                                    │
  1465. │Prototype in: tcutil.h                                              │
  1466. └────────────────────────────────────────────────────────────────────┘
  1467. */
  1468.  
  1469.  
  1470. --------------------------------------------------------------------------
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.                                   - 21 -
  1477.  
  1478.